import { defineStore } from "pinia";
import { reqC1List, reqC2List, reqC3List } from "@/api/product/attr/attr";
import type { AttrDatas } from "./interface/attr";
let CStore = defineStore("C1Store", {
  state: (): AttrDatas => {
    return {
      c1Data: [],
      c1ID: "",
      c2Data: [],
      c2ID: "",
      c3Data: [],
      c3ID: "",
    };
  },

  actions: {
    async getC1Data() {
      
      let result = await reqC1List();
      this.c1Data = result;
    },
    async getC2Data() {
      this.c2Data = [];
      this.c2ID = "";
      this.c3Data = [];
      this.c3ID = "";
      let result = await reqC2List(this.c1ID);
      this.c2Data = result;
    },
    async getC3Data() {
      this.c3Data = [];
      this.c3ID = "";
      let result = await reqC3List(this.c2ID);
      this.c3Data = result;
    },
  },
});

export default CStore;
